<?php

class Application_Model_AclRolesUser extends Sgit_Model
{  
    protected $_name = 'acl_user_groups';
    protected $_primary = array('id_user','id_group');
    
  
   
   function getUsersByGroup($id_group){
        
        $select = $this->db->select()->from(array($this->_name),array('id_user') );
        $select->where('id_group = ?',$id_group);
        $rows = $this->db->fetchCol($select);

        return $rows;
    }
    
    
    function getGroupByUser($id_user){
        
        if (is_null($this->_cache_all_datos)){
            //cache
            $where['id_group < ? '] = 1000;
            $this->_cache_all_datos = $this->getAll($where, 'id_user',null,null,null,null,array('id_user','id_group'));
        }
        $filas = $this->assocArray($this->_cache_all_datos,'id_user','id_group');



        
        return $filas[$id_user];
        
        
        
    }
    
}  




